/*
 * Grim Elsewhere Theme for BSSG
 * Modified version of Microfiche.
 * Monochrome projection look with scanlines and archival framing.
 */

:root {
    --bg-color: black;
    --screen-color: #171a18;
    --panel-color: black;
    --text-color: #ffffff;
    --muted-text: #A6ACA5;
    --title-color: #BD7DED;
	--title-hover: #CC9EF0;
	--heading-color: #ffffff;
    --link-color: #8dbef6;
    --link-hover: #9dceff;
    --border-color: #BD7DED;
	--page-border-color: #a8ada7;
	--article-border-color: #a8ada7;
    --accent-color: #b8c1b5;
    --tag-bg: #2F111E;
    --tag-text: #FF7AAF;
	--nav-bg: #1b1d3f;
	--nav-text: #8dbef6;
    --code-bg: #222723;
	--code-text: #c6c6c6;
    --quote-bg: #222723;
    --overlay-line: rgba(232, 238, 230, 0.04);
    --overlay-noise: rgba(240, 245, 236, 0.035);
    --content-width: 900px;
    --radius: 12px;
    --shadow: 0 12px 24px rgba(0, 0, 0, 0.48);
	--font-body: "IBM Plex Mono", "SFMono-Regular", Menlo, Consolas, "Liberation Mono", monospace;
	--font-heading: "IBM Plex Mono", "SFMono-Regular", Menlo, Consolas, "Liberation Mono", monospace;
    --font-ui: "IBM Plex Mono", "SFMono-Regular", Menlo, Consolas, "Liberation Mono", monospace;
    --font-mono: "IBM Plex Mono", "SFMono-Regular", Menlo, Consolas, "Liberation Mono", monospace;
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
}

*,
*::before,
*::after {
    box-sizing: border-box;
}

html {
    font-size: 15px;
}

body {
    margin: 0;
    color: var(--text-color);
	background-color: var(--bg-color);
    font-family: var(--font-body);
    line-height: 1.7;
    position: relative;
}

body::before,
body::after {
    content: "";
    position: fixed;
    inset: 0;
    pointer-events: none;
}

body::before {
    z-index: 1;
}

body::after {
    background: var(--bg-color);
    background-size: 3px 3px, 4px 4px;
    background-position: 0 0, 2px 1px;
    z-index: 2;
}

::selection {
    background: #dce2d8;
    color: #101311;
}

.container {
    max-width: var(--content-width);
    margin: 0 auto;
    padding: 1.9rem 1.1rem 2.6rem;
    position: relative;
    z-index: 3;
    background: var(--bg-color);
    border-left: 1px solid var(--page-border-color);
    border-right: 1px solid var(--page-border-color);
    box-shadow: var(--shadow);
}

header {
    margin-bottom: 1.8rem;
    padding: 1rem 0 0.95rem;
    border: 1px solid var(--border-color);
	color: var(--heading-color);
    background: var(--bg-color);
}

.site-title,
header h1 {
    margin: 0;
    color: var(--heading-color);
    font-family: var(--font-heading);
    font-weight: 600;
    font-size: clamp(1.9rem, 3.8vw, 2.7rem);
    letter-spacing: 0.06em;
}

.site-title a {
    color: var(--title-color);
    text-decoration: none;
}

.site-title a:hover {
	color: var(--title-hover) !important;
}

header p {
    margin: 0.42rem 0 0;
    color: var(--muted-text);
    font-family: var(--font-ui);
    font-size: 0.8rem;
    letter-spacing: 0.08em;
}

header,
main,
footer {
    padding-left: 0.85rem;
    padding-right: 0.85rem;
}

nav a::before {
	content: "../";
}

nav {
    margin-top: 0.82rem;
    display: flex;
    flex-wrap: wrap;
    gap: 0.45rem 0.5rem;
}

nav a {
    display: inline-block;
    color: var(--nav-text);
    background: var(--nav-bg);
    border: 1px solid #5088f8;
    text-decoration: none;
    font-family: var(--font-ui);
    font-size: 0.72rem;
    text-transform: lowercase;
    letter-spacing: 0.08em;
    padding: 0.18rem 0.5rem;
}

nav a:hover,
nav a:focus {
    background: #202752;
    color: #f4f8f2;
}

main {
    min-height: 62vh;

	.icon {
        display: inline;
        height: 12px;
        border: none;
        margin-bottom: 4px;
        margin-right: 8px;
    }
}

article {
    margin-bottom: 1.4rem;
}

article.post,
article.page,
.posts-list article {
    background: var(--panel-color);
    border: 1px solid var(--article-border-color);
    border-radius: var(--radius);
    padding: 1.1rem 1rem 0.95rem;
    
    p {
        margin-bottom: 2rem;
    }
    
    h1:first-of-type {
        margin-top: 0;
    }
}

h1,
h2,
h3,
h4,
h5,
h6 {
    color: var(--heading-color);
    font-family: var(--font-heading);
    margin: 1.15rem 0 0.7rem;
    margin-top: 3rem;
    line-height: 1.3;
    letter-spacing: 0.03em;

	a.anchor {
		margin-left: -8px;
		color: transparent;
	}

	a::after {
		content: "" !important;
	}
}

h1:hover,
h2:hover,
h3:hover {
	a.anchor {
		color: var(--link-color);
	}
}

h1 { font-size: clamp(1.75rem, 3.4vw, 2.25rem); }
h2 { font-size: clamp(1.4rem, 2.7vw, 1.75rem); }
h3 { font-size: clamp(1.18rem, 2.2vw, 1.4rem); }

.footnote-ref::after, .footnote-back::after {
	content: "" !important;
}

p,
ul,
ol {
    margin-top: 0;
    margin-bottom: 0.95rem;
}

a {
    color: var(--link-color);
    text-decoration-thickness: 1px;
    text-decoration-style: dotted;
    text-underline-offset: 0.14em;
}

a:hover,
a:focus {
    color: var(--link-hover);
}

article a::after {
	content: "⤴";
}

.page-meta {
    margin-bottom: 2.0rem;
    
    .meta {
        margin-bottom: 0;
    }
}

.meta {
    margin: 0;
    color: var(--muted-text);
    font-family: var(--font-ui);
    font-size: 0.8rem;
    letter-spacing: 0.07em;
}

.reading-time {
    margin-top: 0.25rem;
}

.summary {
    margin-top: 0.68rem;
    color: #b8beb6;
}

.post-content {
    margin-top: 0.7rem;
}

.featured-image,
.index-image,
.tag-image,
.archive-image,
.author-image {
    margin: 2rem 0;

	a::after {
		content: "" !important;
	}
}

img {
    display: block;
    max-width: 100%;
	max-height: 300px;
    height: auto;
    border: 1px solid #5b635c;
}

img.placeholder {
	filter: grayscale(50%) contrast(125%);
}

.image-caption,
figcaption {
    margin-top: 0.35rem;
    color: var(--muted-text);
    font-family: var(--font-ui);
    font-size: 0.71rem;
    letter-spacing: 0.06em;
}

blockquote {
    margin: 1rem 0;
    padding: 0.65rem 0.85rem;
    border-left: 3px solid #5088f8;
    background: var(--quote-bg);
    color: #ced5cd;
}

pre,
code {
    font-family: var(--font-mono);
    font-size: 0.84rem;
}

code {
	color: var(--code-text);
    background: var(--code-bg);
    border: 1px solid #3f4741;
    padding: 0.08rem 0.28rem;
    border-radius: 3px;
}

pre {
    background: var(--code-bg);
    border: 1px solid #3f4741;
    border-radius: 4px;
    padding: 0.8rem;
    overflow-x: auto;
}

pre code {
    background: none;
    border: 0;
    padding: 0;
}

code a::after {
	content: "" !important;
}

hr {
    border: 0;
    border-top: 1px dashed #556058;
    margin: 1.2rem 0;
}

.tags {
    display: flex;
    flex-wrap: wrap;
    gap: 0.36rem;
    margin-top: 0.9rem;
}

.tags-list a::before {
	content: "↳ ";
}

.tags-list a.icon::before {
    content: "" !important;
}

.tags-list a.icon {
    border: none;
    background: none;
}

.tags-list a.icon:hover {
    background: none;
}

.tags a::after, .tags-list a::after {
	content: "" !important;
}

.tags a,
.tags-list a {
    display: inline-block;
    text-decoration: none;
    color: var(--tag-text);
    background: var(--tag-bg);
    border: 1px solid #d60270;
    border-radius: 12px;
    padding: 0.18rem 0.45rem;
    font-family: var(--font-ui);
    font-size: 0.72rem;
    letter-spacing: 0.06em;
    text-transform: lowercase;
}

.tags a::before {
	content: "↳ ";
}

.tags a:hover,
.tags a:focus,
.tags-list a:hover,
.tags-list a:focus {
	color: var(--text-color);
    background: #431a25;
}

.tags-list {
    display: flex;
    flex-wrap: wrap;
    gap: 0.44rem;
}

.tag-count {
    color: var(--muted-text);
}

.posts-list article + article {
    margin-top: 0.9rem;
}

.posts-list h2 {
    margin-top: 0;
}

.pagination {
    margin-top: 1.3rem;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.5rem;
}

.pagination a {
    display: inline-block;
    text-decoration: none;
    color: var(--text-color);
    border: 1px solid #68726a;
    background: #2a2f2b;
    padding: 0.2rem 0.55rem;
    font-family: var(--font-ui);
    font-size: 0.8rem;
    letter-spacing: 0.07em;
}

.pagination a:hover,
.pagination a:focus {
    background: #38403a;
    color: #f0f5ee;
}

.page-info {
    color: var(--muted-text);
    font-family: var(--font-ui);
    font-size: 0.73rem;
    letter-spacing: 0.07em;
}

.page-content pre {
	line-height: 1.2;
}

.related-posts {
    margin-top: 1.45rem;
    padding-top: 0.95rem;
    border-top: 1px dashed #5e675f;
}

.related-posts h3 {
    margin-top: 0;
    font-size: 1.05rem;
}

.related-posts-list {
    display: grid;
    gap: 0.65rem;
}

.related-post {
    border: 1px solid var(--border-color);
    background: var(--bg-color);
    padding: 0.55rem 0.66rem;
}

.related-post h4 {
    margin: 0 0 0.24rem;
    font-size: 0.95rem;
}

.related-post p {
    margin: 0;
    color: #b7beb5;
    font-size: 0.9rem;
}

table {
    width: 100%;
    border-collapse: collapse;
    margin: 0.95rem 0;
}

th,
td {
    border: 1px solid #505850;
    padding: 0.4rem 0.52rem;
}

th {
    background: #2b302d;
    font-family: var(--font-ui);
    font-size: 0.73rem;
    letter-spacing: 0.07em;
}

footer {
    margin-top: 1.8rem;
    border-top: 1px solid var(--page-border-color);
    padding-top: 0.8rem;
    color: var(--muted-text);
    font-family: var(--font-ui);
    font-size: 0.8rem;
    letter-spacing: 0.06em;

	.icon {
		display: inline;
		height: 20px;
		border: none;
		margin-bottom: -4px;
		margin-right: 8px;
	}
	
	p {
    	margin: 0.34rem 0;
	}

	a {
    	color: var(--tag-text);
	}

	a:hover,
	a:focus {
    	color: #f5f9f1;
	}
}

@media (max-width: 820px) {
    .container {
        padding: 1.25rem 0.75rem 2rem;
    }

    header,
    main,
    footer {
        padding-left: 0.6rem;
        padding-right: 0.6rem;
    }

    article.post,
    article.page,
    .posts-list article {
        padding: 0.92rem 0.8rem 0.82rem;
    }

    nav a,
    .meta,
    .page-info,
    .pagination a {
        letter-spacing: 0.04em;
    }
}
